package com.anlu.concurrent.ch6.comps;

import java.util.Random;
import java.util.concurrent.Callable;

/**
 * <p>
 * Description:TODO 详细描述
 * <p>
 * Copyright: 天津联想协同科技有限公司
 * <p>
 *
 * @author anlu
 * @date 2021/10/27 17:34
 */
public class WorkTask implements Callable<Integer> {

    private String name;
    public WorkTask(String name) {
        this.name = name;
    }

    @Override
    public Integer call() throws Exception {
        int sleepTime = new Random().nextInt(1000);
        try {
            Thread.sleep(sleepTime);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        // 返回给调用者的值
        return sleepTime;
    }


}
